/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pruebas;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import mundialfp.view.tables.paisPuntos.PuntosTableModel;

/**
 *
 * @author pferraz
 */
public class PruebaCustomResize extends javax.swing.JFrame {

    /**
     * Creates new form PruebaCustomResize
     */
    public PruebaCustomResize() {
        initComponents();

        PuntosTableModel dTM = new PuntosTableModel(0);
        tblTablaConmebol.setModel(dTM);
        Object[] newRow = {1, "aca una imagen", "Bosnia-Herzegovina", 10, 10, 10, 10, 30, 30, 30, 30};
        dTM.addRow(newRow);
        Object[] newRow2 = {10, "aca una imagen", "Chile", 0, 0, 0, 0, 0, 0, 0, 0};
        dTM.addRow(newRow2);
        ((DefaultTableCellRenderer) tblTablaConmebol.getTableHeader().getDefaultRenderer()).setHorizontalAlignment(JLabel.CENTER);

        DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment(JLabel.CENTER);

        for (int i = 0; i < 11; i++) {
            if(i!=2)
                tblTablaConmebol.getColumnModel().getColumn(i).setCellRenderer(centerRenderer);
        }

        tblTablaConmebol.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        tblTablaConmebol.getColumnModel().getColumn(0).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(1).setPreferredWidth(90);
        tblTablaConmebol.getColumnModel().getColumn(2).setPreferredWidth(244);
        tblTablaConmebol.getColumnModel().getColumn(3).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(4).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(5).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(6).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(7).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(8).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(9).setPreferredWidth(30);
        tblTablaConmebol.getColumnModel().getColumn(10).setPreferredWidth(50);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane17 = new javax.swing.JScrollPane();
        tblTablaConmebol = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        tblTablaConmebol.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
        tblTablaConmebol.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "", "", "", "JJ", "G", "E", "P", "GF", "GC", "DG", "PTS"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Object.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane17.setViewportView(tblTablaConmebol);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane17, javax.swing.GroupLayout.DEFAULT_SIZE, 630, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PruebaCustomResize.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PruebaCustomResize.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PruebaCustomResize.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PruebaCustomResize.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PruebaCustomResize().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane17;
    private javax.swing.JTable tblTablaConmebol;
    // End of variables declaration//GEN-END:variables
}
